import com.beans.User;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Created with IntelliJ IDEA.
 * User:xieChao
 * Date:2022/11/28 14:29
 */
public class App {
    public static void main(String[] args) {

        //1.得到 spring 上下文对象

        ApplicationContext context =
                new ClassPathXmlApplicationContext("spring-config.xml");

        //2.根据上下文对象提供的方法获取 bean

//       User user = (User) context.getBean("user");
//        User user = context.getBean(User.class);//只适用于只有一个对象
        User user = context.getBean("user", User.class);

       //3.

        user.sayHi("谢超");
    }
}
